package MockObjects;
use strict;
use warnings;
use Data::Dumper;

use Test::MockObject;

sub getApacheMock
{
	my $mock = new Test::MockObject();
	$mock->mock( uri => sub { '/' } );
	return $mock;
}

sub getSettingsMock
{
	my $mock = new Test::MockObject();
	
	$mock->mock( middle_ware => sub { [] } );
	$mock->mock( url_conf => sub { &getUserUrls } );
	$mock->mock( base => sub { "/home/'.$ENV{USER}.'/rss"} );
	
	return $mock;	
}

sub getUserUrls
{
	my $mock = new Test::MockObject();
	$mock->mock( patterns => sub { 
		[
			[ '^/rss/catalog/?$', "RSS::Catalog::list", {} ],
			[ '^/rss/arch/(A<channel>\d+)/?$', "RSS::Catalog::arch", {} ],	
			[ '^/rss/arch/(A<channel>\d+)/(A<year>\d+)/?$', "RSS::Catalog::arch", {} ],	
			[ '^/rss/arch/(A<channel>\d+)/(A<year>\d+)/(A<month>\d+)/?$', "RSS::Catalog::arch", {} ],	
			
			[ '^/test/args/?$', "Test::Args::list", { test => "arg"} ],
			
			[ '^/testinclude', include("urls.pm") ]
		]
	} );
	
	return $mock;	
		
}

sub include
{
	return '';
}
1;